<template>
	<view class="rule_content">
		<rich-text :nodes='ruleCon'></rich-text>
		<view class="nodata" v-if="!ruleCon">
			<image class="empty_img" :src="IMGLink+'/my/empty.png'" mode="widthFix"></image>
			<view>没有你想要的内容</view>
		</view>
	</view>
</template>

<script>
	import {
		agreementDetail
	} from '@/api/shopping/shopping.js'
	import {
		formatRichText
	} from '../../common/js/util.js'
	export default {
		data() {
			return {
				ruleCon: '',
				type: null,
				IMGLink:this.IMGLink
			}
		},
		onLoad(e) {
			this.type = e.type;
			this.agreementDetail();
		},
		methods: {
			async agreementDetail() {
				const res = await agreementDetail({
					type: this.type
				});
				if (res) {
					const title = res.title
					this.ruleCon = formatRichText(res.data.content);
					uni.setNavigationBarTitle({
						title: title
					})
				}
			},
			goBack() {
				uni.navigateBack();
			}
		}
	}
</script>

<style scoped lang="scss">
	.rule_content {
		padding: 20rpx;
		.nodata {
			text-align: center;
			color: #7D7D7D;
			font-size: 24rpx;
			margin-top: 50%;
		
			.empty_img {
				width: 468rpx;
			}
		}
	}
</style>
